package sctu.edu.java.year2016.team07.nieying.practice.Review;

/**
 * Created by Administrator on 2016/6/16 0016.
 */
public class BubbleSort{
    public static void main(String[] args){
        int arr[]={7,6,8,9,2,0};

        System.out.println("输出数组：");
        for(int i=1;i<arr.length;i++){
            for(int j=0;j<arr.length-i;j++){
                if(arr[j]>arr[j+1]){
                  int temp=arr[j];
                    arr[j]=arr[j+1];
                    arr[j+1]=temp;
                }
                System.out.println(arr[j]+"\t");
            }
            System.out.println("");
            System.out.println("[");
            for(int j=arr.length-i;j<arr.length;j++){
                System.out.println(arr[j]+"\t");
            }
            System.out.println("]");
        }

    }
}
